package org.farng.mp3.id3;

import org.farng.mp3.InvalidTagException;
import org.farng.mp3.object.ObjectNumberHashMap;
import org.farng.mp3.object.ObjectStringSizeTerminated;


/**
 * Title: Description: Copyright:    Copyright (c) 2002 Company:
 *
 * @author Eric Farng
 * @version $Revision: 1.3 $
 */
public abstract class AbstractFrameBodyTextInformation extends AbstractID3v2FrameBody {
    /**
     * Creates a new FrameBodyTextInformation object.
     */
    public AbstractFrameBodyTextInformation() {
        //        setObject("Text Encoding", new Byte((byte) 0));
        //        setObject("Text", "");
    }

    public AbstractFrameBodyTextInformation(AbstractFrameBodyTextInformation body) {
        super(body);
    }

    /**
     * Creates a new FrameBodyTextInformation object.
     *
     * @param textEncoding DOCUMENT ME!
     * @param text DOCUMENT ME!
     */
    public AbstractFrameBodyTextInformation(byte textEncoding, String text) {
        setObject("Text Encoding", new Byte(textEncoding));
        setObject("Text", text);
    }

    /**
     * Creates a new FrameBodyTextInformation object.
     *
     * @param file DOCUMENT ME!
     *
     * @throws java.io.IOException DOCUMENT ME!
     * @throws InvalidTagException DOCUMENT ME!
     */
    public AbstractFrameBodyTextInformation(java.io.RandomAccessFile file)
                                     throws java.io.IOException, InvalidTagException {
        this.read(file);
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public String getBriefDescription() {
        return this.getText();
    }

    /**
     * DOCUMENT ME!
     *
     * @param text DOCUMENT ME!
     */
    public void setText(String text) {
        setObject("Text", text);
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public String getText() {
        return (String) getObject("Text");
    }

    /**
     * DOCUMENT ME!
     *
     * @param textEncoding DOCUMENT ME!
     */
    public void setTextEncoding(byte textEncoding) {
        setObject("Text Encoding", new Byte(textEncoding));
    }

    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    public byte getTextEncoding() {
        return ((Byte) getObject("Text Encoding")).byteValue();
    }

    /**
     * DOCUMENT ME!
     */
    protected void setupObjectList() {
        objectList.add(new ObjectNumberHashMap("Text Encoding", 1));
        objectList.add(new ObjectStringSizeTerminated("Text"));
    }
}